import React, {Component} from 'react';
import News from "./News";
import Message from "./Message";
import {Route, Switch, Redirect} from 'react-router-dom'
import MyNavLink from "../../components/MyNavLink";

class Home extends Component {
    render() {
        return (
            <div>
                <h2>Home组件内容</h2>
                <div>
                    <ul className="nav nav-tabs">
                        {/*  注册路由  */}
                        <li role="presentation">
                            <MyNavLink to="/home/news">News</MyNavLink>
                        </li>
                        <li role="presentation">
                            <MyNavLink to="/home/message">Message</MyNavLink>
                        </li>
                    </ul>
                    <div className="panel panel-default">
                        <div className="panel-body">
                            <Switch>
                                <Route path="/home/news" component={News}/>
                                <Route path="/home/message" component={Message}/>
                                <Redirect to="/home/news"/>
                            </Switch>
                        </div>
                    </div>

                </div>
            </div>
        );
    }
}

export default Home;